package fag.editor;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;

import javax.swing.JFrame;
import javax.swing.WindowConstants;

public class AnimationFrame extends JFrame implements ComponentListener {

	private static final long serialVersionUID = -3808500858993912618L;
	private AnimationPanel animationPanel;

	AnimationFrame(AnimationPanel ap) {
		
		animationPanel = ap;
		setPreferredSize(new Dimension(400,400));
		add(animationPanel);
		pack();
		addComponentListener(this);
		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	}
	
	
	@Override
	public void componentHidden(ComponentEvent e) {}

	@Override
	public void componentMoved(ComponentEvent e) {}

	@Override
	public void componentResized(ComponentEvent e) {
		
		animationPanel.updateCenter(getWidth(),getHeight());
		repaint();
	}

	@Override
	public void componentShown(ComponentEvent e) {}

}
